package com.smile.lambda;


import org.slf4j.Logger;

import static org.slf4j.LoggerFactory.getLogger;

/**
 * @author LiYuhang
 * @version 0.1
 * @application
 * @Date 2021/9/30 09:43
 */
public class LambdaTest1 {

    private static final Logger log = getLogger(LambdaTest1.class);

    public static void main(String[] args)  {

        String name = "myName";
        Thread thread = new Thread() {
            @Override
            public void run() {
                log.info("匿名内部类 run ....:{}",name);
            }
        };
        Thread thread1 = new Thread() {
            @Override
            public void run() {
                log.info("匿名内部类 run ....:{}",name);
            }
        };
        Thread lambdaThread = new Thread(() ->                log.info("lambda run ....:{}",name));
        thread.start();
        thread1.start();
        lambdaThread.start();


    }

}


class MyThread extends Thread {

     private static final Logger log = getLogger(MyThread.class);
    String name;

    public MyThread(String name) {
        this.name = name;
    }

    @Override
    public void run() {
        log.info("MyThread run ....{}",name);
        super.run();
    }
}
